package com.aj.http.response;

import org.json.JSONException;
import org.json.JSONObject;

import com.aj.databases.entry.PetInfo;

public class QueryPetResponse extends BaseRespond {
	private PetInfo petInfo;

	public QueryPetResponse(JSONObject json) {
		super(json);
		try {
			JSONObject resultJSONObject = common.getResult();
			if (resultJSONObject != null) {
				petInfo = new PetInfo();
				if (!resultJSONObject.isNull("ajNo")) {
					petInfo.setAjNo(resultJSONObject.getString("ajNo"));
				}
				if (!resultJSONObject.isNull("photo")) {
					petInfo.setPhoto(resultJSONObject.getString("photo"));
				}
				if (!resultJSONObject.isNull("nickName")) {
					petInfo.setNickName(resultJSONObject.getString("nickName"));
				}
				if (!resultJSONObject.isNull("six")) {
					petInfo.setSix(resultJSONObject.getString("six"));
				}
				if (!resultJSONObject.isNull("birthday")) {
					petInfo.setBirthday(resultJSONObject.getString("birthday"));
				}
				if (!resultJSONObject.isNull("petId")) {
					petInfo.setPetId(resultJSONObject.getString("petId"));
				}
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public PetInfo getPetInfo() {
		return petInfo;
	}

	public void setPetInfo(PetInfo petInfo) {
		this.petInfo = petInfo;
	}

}
